package factory.factoryMethod.pizzaOrderSystem.pizzaStore.base;

import factory.factoryMethod.pizzaOrderSystem.pizza.base.Pizza;

public abstract class PizzaStore {

    // type enum
    public static final String
            CLAM_PIZZA = "clam_pizza", CHEESE_PIZZA = "cheese_pizza";

    // operation
    public Pizza orderPizza(String type)
    {
        Pizza pizza;

        // fixme 若 pizza 为 null，需
        //  throw new IllegalStateException("");

        pizza = createPizza(type);

        pizza.prepare();
        pizza.bake();
        pizza.cut();
        pizza.box();

        return pizza;
    }

    // abstract factory method
    protected abstract Pizza createPizza(String type);
}
